﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using SkypeStudio.Controls.Model;
using System.Windows.Media.Imaging;

namespace SkypeStudio.Controls.Converters
{

    public class OnlineStatuImageConvertor : IValueConverter
    {
        private static readonly OnlineStatuImageConvertor defaultInstance = new OnlineStatuImageConvertor();

        public static OnlineStatuImageConvertor Default { get { return defaultInstance; } }


        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (!(value is OnlineStatus)) return string.Empty;

            OnlineStatus status = (OnlineStatus)value;

            string imageSource = string.Empty;
            switch (status)
            {
                case OnlineStatus.olsUnknown:
                    imageSource = "Images/PresenceInvisible_24x24_s1.png";
                    break;
                case OnlineStatus.olsOffline:
                    imageSource = "Images/PresenceOffline_24x24_s1.png";
                    break;
                case OnlineStatus.olsOnline:
                    imageSource = "Images/PresenceOnline_24x24_s1.png";
                    break;
                case OnlineStatus.olsAway:
                    imageSource = "Images/PresenceAway_24x24_s12.png";
                    break;
                case OnlineStatus.olsNotAvailable:
                    imageSource = "Images/PresenceInvisible_24x24_s1.png";
                    break;
                case OnlineStatus.olsDoNotDisturb:
                    imageSource = "Images/PresenceDoNotDisturb_24x24_s1.png";
                    break;
                case OnlineStatus.olsSkypeOut:
                    imageSource = "Images/PresenceInvisible_24x24_s1.png";
                    break;
                case OnlineStatus.olsSkypeMe:
                    imageSource = "Images/PresenceInvisible_24x24_s1.png";
                    break;
            }

            //SkypeStudio.Controls;
            //return new BitmapImage(new Uri("SkypeStudio.Controls;SkypeStudio.Controls/" + imageSource, UriKind.Relative));
            return "/SkypeStudio.Controls;component/" + imageSource;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
